package com.androidx.p013lv.invention.adapter;

import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.APPLink;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.service.AdClickService;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.bumptech.glide.Glide;

/* renamed from: com.androidx.lv.invention.adapter.AdapterSvipRecommend */
public class AdapterSvipRecommend extends BaseRecyclerAdapter<VideoBean, Holder> {
    private APPLink appLink;
    private boolean clickLimit = true;
    String domain;
    double height = ((double) (((UiUtils.getWindowWidth() - UiUtils.dp2px(18)) * 9) / 16));
    private long lastClickTime;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VideoBean) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
        ImageView imageView = holder.iv_cover;
        if (imageView != null) {
            Glide.with(imageView.getContext()).clear(imageView);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(C1069R.C1074layout.item_svip_recommend, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.androidx.lv.invention.adapter.AdapterSvipRecommend$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        ImageView iv_original;
        ImageView iv_pay;
        ImageView iv_vip;
        ImageView iv_xm;
        RelativeLayout rl_ad;
        RelativeLayout rl_content;
        TextView tv_download;
        TextView tv_name;
        TextView tv_score;
        TextView tv_subtitle;
        TextView tv_time;
        TextView tv_title;

        public Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(C1069R.C1072id.iv_cover);
            this.iv_pay = (ImageView) view.findViewById(C1069R.C1072id.iv_pay);
            this.iv_vip = (ImageView) view.findViewById(C1069R.C1072id.iv_vip);
            this.iv_original = (ImageView) view.findViewById(C1069R.C1072id.iv_original);
            this.tv_name = (TextView) view.findViewById(C1069R.C1072id.tv_name);
            this.tv_score = (TextView) view.findViewById(C1069R.C1072id.tv_score);
            this.tv_title = (TextView) view.findViewById(C1069R.C1072id.tv_title);
            this.tv_time = (TextView) view.findViewById(C1069R.C1072id.tv_time);
            this.tv_download = (TextView) view.findViewById(C1069R.C1072id.tv_download);
            this.iv_xm = (ImageView) view.findViewById(C1069R.C1072id.iv_xm);
            this.rl_content = (RelativeLayout) view.findViewById(C1069R.C1072id.rl_content);
            this.rl_ad = (RelativeLayout) view.findViewById(C1069R.C1072id.rl_ad);
            ViewGroup.LayoutParams layoutParams = this.rl_content.getLayoutParams();
            layoutParams.height = (int) AdapterSvipRecommend.this.height;
            this.rl_content.setLayoutParams(layoutParams);
            this.tv_subtitle = (TextView) view.findViewById(C1069R.C1072id.tv_subtitle);
        }

        public void setData(final VideoBean videoBean, int i) {
            if (videoBean.getCoverImg() == null || videoBean.getCoverImg().size() <= 0 || TextUtils.isEmpty(videoBean.getCoverImg().get(0))) {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadiusWh2(AdapterSvipRecommend.this.domain + videoBean.getCoverImg().get(0), 4, this.iv_cover, 600);
            }
            this.tv_title.setText(videoBean.getTitle());
            TextView textView = this.tv_score;
            textView.setText(videoBean.getFakeWatchNum() + "");
            this.tv_time.setText(TimeUtils.stringForTime(videoBean.getPlayTime() * 1000));
            this.iv_vip.setVisibility(8);
            this.iv_pay.setVisibility(8);
            this.iv_xm.setVisibility(8);
            this.tv_subtitle.setVisibility(8);
            this.iv_cover.setOnClickListener(null);
            if (videoBean.isAd()) {
                this.rl_ad.setVisibility(0);
                this.tv_title.setVisibility(8);
                this.tv_score.setVisibility(8);
                this.tv_time.setVisibility(8);
                this.iv_cover.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.adapter.AdapterSvipRecommend.Holder.View$OnClickListenerC11251 */

                    public void onClick(View view) {
                        if (!AdapterSvipRecommend.this.isOnClick()) {
                            if (videoBean.getAdInfoBean().getJumpType() == 2) {
                                try {
                                    Intent intent = new Intent();
                                    intent.setAction("android.intent.action.VIEW");
                                    intent.setData(Uri.parse(videoBean.getAdInfoBean().getAdJump()));
                                    view.getContext().startActivity(intent);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            } else {
                                if (AdapterSvipRecommend.this.appLink == null) {
                                    AdapterSvipRecommend.this.appLink = new APPLink(view.getContext());
                                }
                                AdapterSvipRecommend.this.appLink.urlLink(videoBean.getAdInfoBean().getAdJump());
                            }
                            Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                            intent2.putExtra("adId", videoBean.getAdInfoBean().getAdId());
                            view.getContext().startService(intent2);
                        }
                    }
                });
                this.tv_download.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.adapter.AdapterSvipRecommend.Holder.View$OnClickListenerC11262 */

                    public void onClick(View view) {
                        if (!AdapterSvipRecommend.this.isOnClick()) {
                            if (videoBean.getAdInfoBean().getJumpType() == 2) {
                                try {
                                    Intent intent = new Intent();
                                    intent.setAction("android.intent.action.VIEW");
                                    intent.setData(Uri.parse(videoBean.getAdInfoBean().getAdJump()));
                                    view.getContext().startActivity(intent);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            } else {
                                if (AdapterSvipRecommend.this.appLink == null) {
                                    AdapterSvipRecommend.this.appLink = new APPLink(view.getContext());
                                }
                                AdapterSvipRecommend.this.appLink.urlLink(videoBean.getAdInfoBean().getAdJump());
                            }
                            Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                            intent2.putExtra("adId", videoBean.getAdInfoBean().getAdId());
                            view.getContext().startService(intent2);
                        }
                    }
                });
                return;
            }
            if (videoBean.getVideoType() == 1) {
                this.iv_vip.setVisibility(0);
            } else if (videoBean.getVideoType() == 2) {
                this.iv_pay.setVisibility(0);
            } else if (videoBean.getVideoType() == 0) {
                this.iv_xm.setVisibility(0);
            }
            if (videoBean.isSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
            this.iv_cover.setOnClickListener(new View.OnClickListener() {
                /* class com.androidx.p013lv.invention.adapter.AdapterSvipRecommend.Holder.View$OnClickListenerC11273 */

                public void onClick(View view) {
                    if (!AdapterSvipRecommend.this.isOnClick()) {
                        ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(videoBean.getVideoId())).navigation();
                    }
                }
            });
            this.rl_ad.setVisibility(8);
            this.tv_title.setVisibility(0);
            this.tv_score.setVisibility(0);
            this.tv_time.setVisibility(0);
            this.tv_title.setText(videoBean.getTitle());
            TextView textView2 = this.tv_score;
            textView2.setText(videoBean.getScore() + "分");
            this.tv_time.setText(TimeUtils.stringForTime(videoBean.getPlayTime() * 1000));
        }
    }

    public boolean isOnClick() {
        long currentTimeMillis = System.currentTimeMillis();
        long j = currentTimeMillis - this.lastClickTime;
        if (j > 1000) {
            this.lastClickTime = currentTimeMillis;
        }
        return !this.clickLimit ? j < 0 : j <= 1000;
    }
}
